package com.feihong.txgw.utils;

import java.io.File;

import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * @Author wangziheng
 * @ProjectName txgw_app
 * @ClassName RetrofitUtil
 * @package com.feihong.txgw.utils
 * @data 2018/5/8 18:16
 * @Describe  文本/图片转RequestBody
 * @Change
 */
public class RetrofitUtil {
    public static RequestBody toRequestBodyOfText (String value) {
        RequestBody body = RequestBody.create(MediaType.parse("text/plain"), value);
        return body ;
    }

    public static RequestBody toRequestBodyOfImage(File pFile){

//        RequestBody fileBody = RequestBody.create(MediaType.parse("image/*"), pFile);
        RequestBody fileBody = RequestBody.create(MediaType.parse("multipart/form-data"), pFile);
        return fileBody;
    }
}
